var g, _extends = Object.assign || function(t) {
    for (var e = 1; e < arguments.length; e++) {
        var a, s = arguments[e];
        for (a in s) Object.prototype.hasOwnProperty.call(s, a) && (t[a] = s[a]);
    }
    return t;
}, _tools = require("../../../utils/tools"), app = getApp(), page = app.page, request = app.util.request, route = app.route, toast = app.toast;

page({
    data: {
        state: 1
    },
    onLoad: function(t) {
        (g = this).setData(_extends({}, app.item), app.item = "");
    },
    onPullDownRefresh: function() {},
    submitClassEdit: function(t) {
        (0, _tools.subscribe)("LAWYER");
        var e = (t = t.detail.value).title, a = t.sort, t = t.state;
        if (!e) return toast("请填写分类标题");
        request({
            url: "MLawArticleTypeAdd",
            data: {
                id: g.data.id || "",
                title: e,
                sort: a || "0",
                state: t ? "1" : "0",
                user_id: g.data.userInfo.id
            },
            success: function(t) {
                1 == t ? (toast((g.data.id ? "修改" : "添加") + "成功"), setTimeout(function() {
                    route({
                        type: "navigateBack",
                        delta: 1
                    });
                }, 1500)) : toast((g.data.id ? "修改" : "添加") + "失败:" + t);
            }
        });
    }
});